﻿using System.Drawing;
using System.IO;
using System.Drawing.Imaging;

namespace Neudesic.Pulse.Client.Tests
{
    internal static class Extensions
    {

        /// <summary>
        /// Gets the bytes.
        /// </summary>
        /// <param name="bitmap">The bitmap.</param>
        /// <param name="format">The format.</param>
        /// <returns></returns>
        internal static byte[] GetBytes(this Bitmap bitmap, ImageFormat format)
        {
            using (MemoryStream stream = new MemoryStream())
            {
                bitmap.Save(stream, format);
                return stream.ToArray();
            }
        }

    }
}
